|
|
|
|
|
|
|
Figure 2.12
Program Curves demonstrates the
Ellipse, Arc, Chord, and Pie API functions. |
|
|
|
|
|
|
|
|
The SetBkMode API function determines whether the area behind a fill pattern is erased or preserved during a fill operation. If this function's second parameter is the constant TRANSPARENT, the area behind the fill pattern is preserved. If this parameter is OPAQUE, the area behind the fill pattern is erased. |
|
|
|
|
|
|
|
|
Normally, the area behind the pattern is set through use of the drawing object's BackColor property. You can change this color using the SetBkColor API function. You can use Visual Basic's FillColor property to change the color of the pattern itself. |
|
|
|
 |
|
|
|
|
Private Const OPAQUE = 2
Private Const TRANSPARENT = 1
Private Declare Function SetBkColor Lib "gdi32" ( _
ByVal hdc As Long, ByVal crColor As Long) As Long
Private Declare Function SetBkMode Lib "gdi32" ( _
ByVal hdc As Long, ByVal nBkMode As Long) As Long |
|
|
|
|
|
|
|
|
Example program BkMode, shown in Figure 2.13, demonstrates the SetBkMode and SetBkColor API functions. The program fills its form with a checkerboard pattern. It then draws two ellipses. For the first ellipse, the program sets the background mode to TRANSPARENT. For the second, it sets the background mode to OPAQUE and the background color to white. |
|
|
|
|
|
|
|
|
When you draw polygons using the Polygon or PolyPolygon API functions, there are two ways the function can fill them: WINDING and ALTERNATE. You can use the SetPolyFillMode API function to determine which method to use. The following code shows how to declare this function in Visual Basic. |
|
|
|
|
|